using System;
using miPics.Common;


public partial class _Administration_Default : miPics.BasePage.BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
		// set menu to administration
		Master.SetMenuAdministrationTask();

		// setup interface panels
		_Interface.Visible = true;
		_LoggedInMessage.Visible = false;
		_ErrorMessage.Visible = false;

		if (this.IsLoggedIn)
		{
			_Interface.Visible = false;
			_LoggedInMessage.Visible = true;
		}
    }

	protected void DoLogin(object sender, EventArgs e)
	{
		// attempt user login here
		if (
			(_Username.Value == Config.Administration.Username) &&
			(_Password.Value == Config.Administration.Password)
		)
		{
			// valid username/password so login user
			this.LoginUser();
		}
		else
		{
			// invalid login details, show error message
			_ErrorMessage.Visible = true;

			// clear username/password fields
			_Username.Value = "";
			_Password.Value = "";
		}
	}

	protected void CancelLogin(object sender, EventArgs e)
	{
		// redirect back to home
		Response.Redirect("~/");
	}
}